First, I need to create the function that will be used across the Dietary factors and sets of data.
Running ANOVAs for Previously calc. HEI Scores
Time Point 1:RecallNum 1 - BMI Categories
metrics <- c('HEI2010_TOTAL_SCORE', 'HEIX1_TOTALVEG', 'HEIX2_GREEN_AND_BEAN', 'HEIX3_TOTALFRUIT', 'HEIX4_WHOLEFRUIT', 'HEIX5_WHOLEGRAIN', 'HEIX6_TOTALDAIRY', 'HEIX7_TOTPROT', 'HEIX8_SEAPLANT_PROT', 'HEIX9_FATTYACID', 'HEIX10_SODIUM', 'HEIX11_REFINEDGRAIN', 'HEIX12_SOFAAS')
group.var <- c('BMI_Class', 'GWG_Cat')
## Data Subset
## subset to only Stool (S) and first timepoint (01)
ffq_t1 <- filter(cfrip_data, SampleSource == 'S-01', RecallNo == 1 )
## Initialize results matrix
results.bmi <- as.data.frame(matrix(NA, nrow=length(metrics), ncol=15))
iter<- 1
for(met in metrics){
results.bmi[iter,1] <- met
res.out <- ffq_anova(data=ffq_t1, v.n=met, group= group.var[1])
results.bmi[iter,2:15] <- res.out
iter <- iter + 1
}
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.95652, p-value = 0.5361
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.49767, p-value = 0.0001209
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 0.7153 0.505
## 15
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.93, p-value = 0.1942
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.17896, p-value = 0.5522
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 0.5013 0.6155
## 15
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.68676, p-value = 5.626e-05
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.46434, p-value = 0.0008512
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 0.5524 0.5869
## 15
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.91678, p-value = 0.1134
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.37609, p-value = 0.01229
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 0.1084 0.898
## 15
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.87386, p-value = 0.02061
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.42914, p-value = 0.002641
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 2.9118 0.08541 .
## 15
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.93114, p-value = 0.2034
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.35478, p-value = 0.02153
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 1.4263 0.271
## 15
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.93822, p-value = 0.2701
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.36224, p-value = 0.01776
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 0.0737 0.9293
## 15
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.8096, p-value = 0.002082
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.30331, p-value = 0.07289
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 2.6899 0.1004
## 15
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.92919, p-value = 0.1879
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.3294, p-value = 0.04023
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 1.986 0.1717
## 15
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.92386, p-value = 0.1513
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.37755, p-value = 0.01181
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 2.331 0.1314
## 15
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.87051, p-value = 0.01814
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.48551, p-value = 0.0004127
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 2.6257 0.1053
## 15
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.94262, p-value = 0.3211
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.42932, p-value = 0.002626
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 0.1417 0.8691
## 15
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.9522, p-value = 0.4605
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.3325, p-value = 0.03737
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 0.0209 0.9794
## 15
colnames(results.bmi) <- c('Dietary Factor', names(res.out))
##Print out summary table
kable(results.bmi, format = 'html', digits=3) %>%
kable_styling(full_width = T)
|
Dietary Factor
|
Total
|
SE Total
|
Normal
|
SE Normal
|
Class 1
|
SE Class 1
|
Class 2-3
|
SE Class 2-3
|
df Effect
|
df Error
|
f-value
|
p-value
|
omega2
|
eta2
|
|
HEI2010_TOTAL_SCORE
|
52.889
|
3.507
|
56.434
|
4.708
|
59.248
|
8.313
|
45.308
|
4.970
|
2
|
15
|
1.653
|
0.225
|
0.068
|
0.181
|
|
HEIX1_TOTALVEG
|
3.195
|
0.318
|
2.943
|
0.566
|
3.791
|
0.480
|
2.986
|
0.581
|
2
|
15
|
0.649
|
0.536
|
0.000
|
0.080
|
|
HEIX2_GREEN_AND_BEAN
|
1.258
|
0.496
|
0.833
|
0.833
|
1.528
|
0.926
|
1.429
|
0.922
|
2
|
15
|
0.168
|
0.847
|
0.000
|
0.022
|
|
HEIX3_TOTALFRUIT
|
2.408
|
0.555
|
3.489
|
0.959
|
2.420
|
0.965
|
1.474
|
0.911
|
2
|
15
|
1.213
|
0.325
|
0.023
|
0.139
|
|
HEIX4_WHOLEFRUIT
|
1.746
|
0.564
|
2.737
|
1.034
|
2.000
|
1.225
|
0.714
|
0.714
|
2
|
15
|
1.228
|
0.321
|
0.025
|
0.141
|
|
HEIX5_WHOLEGRAIN
|
4.291
|
0.861
|
4.645
|
1.357
|
5.116
|
2.141
|
3.398
|
1.294
|
2
|
15
|
0.336
|
0.720
|
0.000
|
0.043
|
|
HEIX6_TOTALDAIRY
|
4.777
|
0.894
|
3.123
|
1.462
|
4.303
|
1.768
|
6.533
|
1.372
|
2
|
15
|
1.426
|
0.271
|
0.045
|
0.160
|
|
HEIX7_TOTPROT
|
4.266
|
0.295
|
3.537
|
0.677
|
4.651
|
0.311
|
4.615
|
0.385
|
2
|
15
|
1.637
|
0.227
|
0.066
|
0.179
|
|
HEIX8_SEAPLANT_PROT
|
1.832
|
0.553
|
2.953
|
0.944
|
2.000
|
1.225
|
0.752
|
0.709
|
2
|
15
|
1.527
|
0.249
|
0.055
|
0.169
|
|
HEIX9_FATTYACID
|
6.027
|
0.843
|
7.928
|
0.974
|
6.999
|
1.902
|
3.704
|
1.117
|
2
|
15
|
3.141
|
0.073
|
0.192
|
0.295
|
|
HEIX10_SODIUM
|
3.275
|
0.865
|
4.599
|
1.873
|
2.373
|
1.271
|
2.783
|
1.336
|
2
|
15
|
0.574
|
0.575
|
0.000
|
0.071
|
|
HEIX11_REFINEDGRAIN
|
5.130
|
0.973
|
4.410
|
1.721
|
7.211
|
1.899
|
4.262
|
1.533
|
2
|
15
|
0.868
|
0.440
|
0.000
|
0.104
|
|
HEIX12_SOFAAS
|
14.684
|
0.927
|
15.237
|
1.550
|
16.857
|
1.729
|
12.658
|
1.354
|
2
|
15
|
1.946
|
0.177
|
0.095
|
0.206
|
ffq_t1 %>%
group_by(BMI_Class) %>%
summarise(n = n())
## # A tibble: 3 x 2
## BMI_Class n
## <ord> <int>
## 1 Normal 6
## 2 Class 1 5
## 3 Class 2-3 7
Time Point 2:RecallNum 2 - BMI Categories
## Data
## subset to only Stool (S) and second timepoint (02)
ffq_t2 <- filter(cfrip_data, SampleSource == "S-02", RecallNo == 2)
## Initize reults matrix
results.bmi <- as.data.frame(matrix(NA, nrow=length(metrics), ncol=15))
iter<- 1
for(met in metrics){
results.bmi[iter,1] <- met
res.out <- ffq_anova(data=ffq_t2, v.n=met, group= group.var[1])
results.bmi[iter,2:15] <- res.out
iter <- iter + 1
}
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.90821, p-value = 0.2024
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.44786, p-value = 0.01029
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 11.187 0.003627 **
## 9
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.94647, p-value = 0.586
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.14627, p-value = 0.9272
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 1.9496 0.1979
## 9
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.91276, p-value = 0.2314
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.4202, p-value = 0.02888
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 1.8653 0.21
## 9
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.95727, p-value = 0.7442
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.29164, p-value = 0.2592
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 8.4581 0.008571 **
## 9
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.97013, p-value = 0.9121
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.26366, p-value = 0.3165
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 6.4643 0.01818 *
## 9
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.91224, p-value = 0.2279
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.31911, p-value = 0.1735
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 2.0448 0.1853
## 9
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.94779, p-value = 0.6049
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.37169, p-value = 0.07261
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 3.2051 0.08891 .
## 9
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.8525, p-value = 0.03942
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.26123, p-value = 0.386
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 4.8837 0.03662 *
## 9
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.79248, p-value = 0.007704
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.45221, p-value = 0.01478
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 0.1607 0.8539
## 9
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.92649, p-value = 0.3444
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.2864, p-value = 0.23
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 2.9151 0.1057
## 9
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.92276, p-value = 0.3096
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.49118, p-value = 0.006114
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 0.1576 0.8565
## 9
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.87325, p-value = 0.07187
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.5144, p-value = 0.001788
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 0.4908 0.6276
## 9
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.9294, p-value = 0.3738
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.39364, p-value = 0.03463
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 0.233 0.7968
## 9
colnames(results.bmi) <- c('Dietary Factor', names(res.out))
##Print out summary table
kable(results.bmi, format = 'html', digits=3) %>%
kable_styling(full_width = T)
|
Dietary Factor
|
Total
|
SE Total
|
Normal
|
SE Normal
|
Class 1
|
SE Class 1
|
Class 2-3
|
SE Class 2-3
|
df Effect
|
df Error
|
f-value
|
p-value
|
omega2
|
eta2
|
|
HEI2010_TOTAL_SCORE
|
53.303
|
3.291
|
60.693
|
2.166
|
51.718
|
13.160
|
50.401
|
2.165
|
2
|
9
|
0.827
|
0.468
|
0.000
|
0.155
|
|
HEIX1_TOTALVEG
|
2.170
|
0.422
|
2.064
|
0.113
|
3.182
|
1.133
|
1.717
|
0.616
|
2
|
9
|
1.019
|
0.399
|
0.003
|
0.185
|
|
HEIX2_GREEN_AND_BEAN
|
1.915
|
0.622
|
1.667
|
1.667
|
3.181
|
1.596
|
1.406
|
0.645
|
2
|
9
|
0.663
|
0.539
|
0.000
|
0.128
|
|
HEIX3_TOTALFRUIT
|
3.250
|
0.646
|
5.000
|
0.000
|
1.714
|
1.644
|
3.143
|
0.868
|
2
|
9
|
1.893
|
0.206
|
0.130
|
0.296
|
|
HEIX4_WHOLEFRUIT
|
3.193
|
0.643
|
5.000
|
0.000
|
1.761
|
1.622
|
3.006
|
0.870
|
2
|
9
|
1.890
|
0.206
|
0.129
|
0.296
|
|
HEIX5_WHOLEGRAIN
|
2.032
|
0.672
|
1.006
|
0.528
|
2.738
|
1.721
|
2.191
|
1.084
|
2
|
9
|
0.395
|
0.684
|
0.000
|
0.081
|
|
HEIX6_TOTALDAIRY
|
4.756
|
0.906
|
2.656
|
0.885
|
4.333
|
1.586
|
6.018
|
1.476
|
2
|
9
|
1.233
|
0.336
|
0.037
|
0.215
|
|
HEIX7_TOTPROT
|
4.462
|
0.211
|
4.562
|
0.246
|
4.565
|
0.237
|
4.360
|
0.410
|
2
|
9
|
0.097
|
0.909
|
0.000
|
0.021
|
|
HEIX8_SEAPLANT_PROT
|
1.921
|
0.665
|
2.383
|
1.448
|
1.667
|
1.667
|
1.817
|
0.969
|
2
|
9
|
0.070
|
0.933
|
0.000
|
0.015
|
|
HEIX9_FATTYACID
|
6.230
|
0.991
|
9.467
|
0.533
|
7.179
|
1.411
|
4.137
|
1.362
|
2
|
9
|
3.924
|
0.060
|
0.328
|
0.466
|
|
HEIX10_SODIUM
|
3.481
|
1.078
|
5.091
|
2.586
|
4.086
|
2.093
|
2.373
|
1.534
|
2
|
9
|
0.533
|
0.604
|
0.000
|
0.106
|
|
HEIX11_REFINEDGRAIN
|
4.229
|
1.173
|
3.794
|
2.810
|
3.262
|
3.167
|
4.931
|
1.504
|
2
|
9
|
0.162
|
0.853
|
0.000
|
0.035
|
|
HEIX12_SOFAAS
|
15.664
|
1.165
|
18.005
|
1.995
|
14.050
|
2.963
|
15.300
|
1.607
|
2
|
9
|
0.732
|
0.508
|
0.000
|
0.140
|
ffq_t2 %>%
group_by(BMI_Class) %>%
summarise(n = n())
## # A tibble: 3 x 2
## BMI_Class n
## <ord> <int>
## 1 Normal 3
## 2 Class 1 3
## 3 Class 2-3 6
Time Point 1:RecallNum 1 - GWG Categories ANOVA for women with pre-preg BMI >= 30
results.gwg <- as.data.frame(matrix(NA, nrow=length(metrics), ncol=15))
## Subset to BMI>30
ffq_t1.bmi30p <- filter(ffq_t1, PrePreg_BMI >=30)
iter<- 1
for(met in metrics){
results.gwg[iter,1] <- met
res.out <- ffq_anova(data=ffq_t1.bmi30p, v.n=met, group= group.var[2])
k <- length(res.out)
#if(k != 14)
results.gwg[iter,2:15] <- res.out
iter <- iter + 1
}
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.96267, p-value = 0.8212
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.49995, p-value = 0.002684
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 1.3442 0.3084
## 9
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.95625, p-value = 0.7293
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.19377, p-value = 0.6902
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 0.6929 0.525
## 9
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.71891, p-value = 0.00129
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.47768, p-value = 0.008369
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 0.3819 0.6931
## 9
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.87156, p-value = 0.0684
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.32391, p-value = 0.1611
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 17.479 0.0007951 ***
## 9
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.82333, p-value = 0.01747
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.39435, p-value = 0.04788
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 8.5414 0.008327 **
## 9
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.92381, p-value = 0.319
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.47038, p-value = 0.005886
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 0.2553 0.7801
## 9
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.93616, p-value = 0.45
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.37021, p-value = 0.07456
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 2.4339 0.1429
## 9
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.75538, p-value = 0.003043
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.33333, p-value = 0.1389
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 3.8413 0.06222 .
## 9
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.83175, p-value = 0.02201
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.39435, p-value = 0.04788
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 8.2923 0.009082 **
## 9
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.89445, p-value = 0.1345
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.36634, p-value = 0.07983
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 8.8275 0.007553 **
## 9
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.86848, p-value = 0.06251
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.42121, p-value = 0.0283
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 13.679 0.001868 **
## 9
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.96732, p-value = 0.8808
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.39839, p-value = 0.04434
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 0.311 0.7403
## 9
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.90817, p-value = 0.2021
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.41676, p-value = 0.03095
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 0.4785 0.6346
## 9
colnames(results.gwg) <- c('Dietary Factor', names(res.out))
##Print out summary table
kable(results.gwg, format = 'html', digits=3) %>%
kable_styling(full_width = T)
|
Dietary Factor
|
Total
|
SE Total
|
Below
|
SE Below
|
Within
|
SE Within
|
Above
|
SE Above
|
df Effect
|
df Error
|
f-value
|
p-value
|
omega2
|
eta2
|
|
HEI2010_TOTAL_SCORE
|
51.117
|
4.756
|
50.309
|
7.385
|
59.065
|
8.447
|
38.946
|
4.862
|
2
|
9
|
1.544
|
0.265
|
0.083
|
0.256
|
|
HEIX1_TOTALVEG
|
3.322
|
0.396
|
2.941
|
0.743
|
3.295
|
0.732
|
3.874
|
0.556
|
2
|
9
|
0.351
|
0.713
|
0.000
|
0.072
|
|
HEIX2_GREEN_AND_BEAN
|
1.470
|
0.633
|
1.250
|
1.250
|
1.528
|
0.926
|
1.667
|
1.667
|
2
|
9
|
0.028
|
0.973
|
0.000
|
0.006
|
|
HEIX3_TOTALFRUIT
|
1.868
|
0.652
|
2.500
|
1.443
|
2.349
|
1.005
|
0.225
|
0.113
|
2
|
9
|
1.079
|
0.380
|
0.013
|
0.193
|
|
HEIX4_WHOLEFRUIT
|
1.250
|
0.653
|
1.250
|
1.250
|
2.000
|
1.225
|
0.000
|
0.000
|
2
|
9
|
0.692
|
0.525
|
0.000
|
0.133
|
|
HEIX5_WHOLEGRAIN
|
4.114
|
1.137
|
3.097
|
1.801
|
5.833
|
1.806
|
2.603
|
2.603
|
2
|
9
|
0.800
|
0.479
|
0.000
|
0.151
|
|
HEIX6_TOTALDAIRY
|
5.604
|
1.087
|
6.874
|
2.021
|
4.999
|
2.093
|
4.918
|
1.271
|
2
|
9
|
0.298
|
0.749
|
0.000
|
0.062
|
|
HEIX7_TOTPROT
|
4.630
|
0.249
|
4.327
|
0.673
|
4.651
|
0.311
|
5.000
|
0.000
|
2
|
9
|
0.476
|
0.636
|
0.000
|
0.096
|
|
HEIX8_SEAPLANT_PROT
|
1.272
|
0.649
|
1.250
|
1.250
|
2.052
|
1.204
|
0.000
|
0.000
|
2
|
9
|
0.744
|
0.502
|
0.000
|
0.142
|
|
HEIX9_FATTYACID
|
5.077
|
1.089
|
5.009
|
1.514
|
6.222
|
2.317
|
3.259
|
0.920
|
2
|
9
|
0.530
|
0.606
|
0.000
|
0.105
|
|
HEIX10_SODIUM
|
2.613
|
0.904
|
3.791
|
2.189
|
2.373
|
1.271
|
1.440
|
1.153
|
2
|
9
|
0.459
|
0.646
|
0.000
|
0.092
|
|
HEIX11_REFINEDGRAIN
|
5.491
|
1.219
|
4.488
|
1.864
|
7.211
|
1.899
|
3.960
|
3.069
|
2
|
9
|
0.683
|
0.529
|
0.000
|
0.132
|
|
HEIX12_SOFAAS
|
14.408
|
1.194
|
13.532
|
2.180
|
16.552
|
1.809
|
12.001
|
1.924
|
2
|
9
|
1.351
|
0.307
|
0.055
|
0.231
|
ffq_t1.bmi30p %>%
group_by(GWG_Cat) %>%
summarise(n = n())
## # A tibble: 3 x 2
## GWG_Cat n
## <ord> <int>
## 1 Below 4
## 2 Within 5
## 3 Above 3
Time Point 2:RecallNum 2 - GWG Categories ANOVA for women with pre-preg BMI >= 30
results.gwg <- as.data.frame(matrix(NA, nrow=length(metrics), ncol=15))
## Subset to BMI>30
ffq_t2.bmi30p <- filter(ffq_t2, PrePreg_BMI >=30)
iter<- 1
for(met in metrics){
results.gwg[iter,1] <- met
res.out <- ffq_anova(data=ffq_t2.bmi30p, v.n=met, group= group.var[2])
results.gwg[iter,2:15] <- res.out
iter <- iter + 1
}
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.92738, p-value = 0.4568
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.47886, p-value = 0.02029
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 1.0497 0.4065
## 6
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.9069, p-value = 0.2947
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.17138, p-value = 0.9158
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 1.5329 0.2899
## 6
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.90959, p-value = 0.313
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.34374, p-value = 0.188
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 0.2643 0.7762
## 6
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.83843, p-value = 0.05548
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.39665, p-value = 0.1178
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 1.6949 0.2609
## 6
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.94844, p-value = 0.6729
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.34034, p-value = 0.1967
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 0.1787 0.8407
## 6
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.87614, p-value = 0.1429
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.32963, p-value = 0.2821
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 1.8031 0.2437
## 6
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.91271, p-value = 0.3353
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.36109, p-value = 0.1912
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 9.8228 0.01281 *
## 6
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.92389, p-value = 0.4254
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.23096, p-value = 0.7231
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 5.0971 0.05086 .
## 6
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.77678, p-value = 0.01106
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.24156, p-value = 0.6698
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 3.0574 0.1215
## 6
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.86718, p-value = 0.1147
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.34163, p-value = 0.1933
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 1.3881 0.3195
## 6
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.93087, p-value = 0.4897
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.33224, p-value = 0.2736
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 5.6198 0.04216 *
## 6
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.85221, p-value = 0.07881
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.44402, p-value = 0.03908
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 2.4241 0.1692
## 6
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.93537, p-value = 0.534
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.33256, p-value = 0.2178
## alternative hypothesis: two-sided

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 6.1487 0.03526 *
## 6
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
colnames(results.gwg) <- c('Dietary Factor', names(res.out))
##Print out summary table
kable(results.gwg, format = 'html', digits=3) %>%
kable_styling(full_width = T)
|
Dietary Factor
|
Total
|
SE Total
|
Below
|
SE Below
|
Within
|
SE Within
|
Above
|
SE Above
|
df Effect
|
df Error
|
f-value
|
p-value
|
omega2
|
eta2
|
|
HEI2010_TOTAL_SCORE
|
50.840
|
4.054
|
51.559
|
4.221
|
52.657
|
8.952
|
46.127
|
5.260
|
2
|
6
|
0.158
|
0.857
|
0.000
|
0.050
|
|
HEIX1_TOTALVEG
|
2.206
|
0.570
|
1.370
|
0.504
|
3.178
|
1.106
|
1.514
|
0.412
|
2
|
6
|
1.239
|
0.354
|
0.050
|
0.292
|
|
HEIX2_GREEN_AND_BEAN
|
1.998
|
0.688
|
1.152
|
1.152
|
2.992
|
1.144
|
1.278
|
1.278
|
2
|
6
|
0.795
|
0.494
|
0.000
|
0.210
|
|
HEIX3_TOTALFRUIT
|
2.667
|
0.772
|
3.333
|
1.667
|
3.079
|
1.160
|
0.841
|
0.841
|
2
|
6
|
0.761
|
0.507
|
0.000
|
0.202
|
|
HEIX4_WHOLEFRUIT
|
2.591
|
0.760
|
1.909
|
1.560
|
3.558
|
1.100
|
1.681
|
1.681
|
2
|
6
|
0.586
|
0.585
|
0.000
|
0.164
|
|
HEIX5_WHOLEGRAIN
|
2.373
|
0.863
|
2.783
|
1.723
|
2.678
|
1.563
|
1.150
|
1.150
|
2
|
6
|
0.233
|
0.799
|
0.000
|
0.072
|
|
HEIX6_TOTALDAIRY
|
5.457
|
1.094
|
9.122
|
0.878
|
2.893
|
0.619
|
5.087
|
2.236
|
2
|
6
|
10.429
|
0.011
|
0.677
|
0.777
|
|
HEIX7_TOTPROT
|
4.429
|
0.275
|
3.721
|
0.657
|
4.877
|
0.123
|
4.593
|
0.407
|
2
|
6
|
2.283
|
0.183
|
0.222
|
0.432
|
|
HEIX8_SEAPLANT_PROT
|
1.767
|
0.790
|
0.426
|
0.426
|
1.250
|
1.250
|
4.811
|
0.189
|
2
|
6
|
3.766
|
0.087
|
0.381
|
0.557
|
|
HEIX9_FATTYACID
|
5.151
|
1.093
|
1.675
|
1.625
|
7.110
|
1.086
|
6.446
|
0.755
|
2
|
6
|
5.297
|
0.047
|
0.488
|
0.638
|
|
HEIX10_SODIUM
|
2.944
|
1.195
|
4.747
|
2.478
|
3.065
|
1.798
|
0.000
|
0.000
|
2
|
6
|
1.076
|
0.399
|
0.017
|
0.264
|
|
HEIX11_REFINEDGRAIN
|
4.375
|
1.362
|
3.633
|
2.006
|
5.378
|
2.580
|
3.480
|
3.338
|
2
|
6
|
0.173
|
0.845
|
0.000
|
0.054
|
|
HEIX12_SOFAAS
|
14.883
|
1.360
|
17.688
|
1.637
|
12.597
|
2.456
|
15.247
|
0.124
|
2
|
6
|
1.518
|
0.293
|
0.103
|
0.336
|
ffq_t2.bmi30p %>%
group_by(GWG_Cat) %>%
summarise(n = n())
## # A tibble: 3 x 2
## GWG_Cat n
## <ord> <int>
## 1 Below 3
## 2 Within 4
## 3 Above 2
Analyses with Newly Created HEI Scores
- HEI total (HEI2015_TOTAL_SCORE)
- Total Veg (HEI2015C1_TOTALVEG)
- Green beans (HEIX2_GREEN_AND_BEAN)
- Total fruit (HEI2015C3_TOTALFRUIT)
- Whole fruit (HEI2015C4_WHOLEFRUIT)
- Whole grains (HEI2015C5_WHOLEGRAIN)
- Dairy (HEI2015C6_TOTALDAIRY)
- Total protein (HEI2015C7_TOTPROT)
- Seafood (HEI2015C8_SEAPLANT_PROT)
- Fatty Acids (HEI2015C9_FATTYACID)
- Sodium (HEI2015C10_SODIUM)
- Refined Grains (HEI2015C11_REFINEDGRAIN)
- Saturated Fat (HEI2015C12_SFAT)
- Added Sugars (HEI2015C13_ADDSUG)
BMI Categories vs New HEI Scores
#metrics <- c('HEI2015_TOTAL_SCORE','HEI2015C1_TOTALVEG','HEIX2_GREEN_AND_BEAN','HEI2015C3_TOTALFRUIT','HEI2015C4_WHOLEFRUIT','HEI2015C5_WHOLEGRAIN','HEI2015C6_TOTALDAIRY','HEI2015C7_TOTPROT','HEI2015C8_SEAPLANT_PROT','HEI2015C9_FATTYACID','HEI2015C10_SODIUM','HEI2015C11_REFINEDGRAIN','HEI2015C12_SFAT','HEI2015C13_ADDSUG')
metrics <- c("heix1_totalveg", "heix2_greens_and_bean", "heix3_totalfruit" , "heix4_wholefruit", "heix5_wholegrain", "heix6_totaldairy" ,
"heix7_totprot" , "heix8_seaplant_prot",
"heix9_fattyacid", "heix10_sodium",
"heix11_refinedgrain", "heix12_sofaas","hei2010_total_score")
group.var <- c('BMI_Class', 'GWG_Cat')
results.bmi <- as.data.frame(matrix(NA, nrow=length(metrics), ncol=15))
iter<- 1
for(met in metrics){
results.bmi[iter,1] <- met
res.out <- ffq_anova(data=hei_scores, v.n=met, group= group.var[1])
results.bmi[iter,2:15] <- res.out
iter <- iter + 1
}
##
## =============================
##
## Tests and Plots of Normality:



##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.84523, p-value = 0.009079
##
##
## K-S Test for Normality of Residuals:
## Warning in ks.test(aov.out$residuals, "pnorm", alternative = "two.sided"): ties should not be present for the Kolmogorov-Smirnov test

##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.28844, p-value = 0.1182
## alternative hypothesis: two-sided
## Warning: Removed 2 rows containing non-finite values (stat_boxplot).
## Warning: Removed 2 rows containing missing values (geom_point).

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 0.6372 0.5434
## 14
##
## =============================
##
## Tests and Plots of Normality:



##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.932, p-value = 0.2351
##
##
## K-S Test for Normality of Residuals:
## Warning in ks.test(aov.out$residuals, "pnorm", alternative = "two.sided"): ties should not be present for the Kolmogorov-Smirnov test

##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.28339, p-value = 0.1303
## alternative hypothesis: two-sided
## Warning: Removed 2 rows containing non-finite values (stat_boxplot).
## Warning: Removed 2 rows containing missing values (geom_point).

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 0.0554 0.9463
## 14
##
## =============================
##
## Tests and Plots of Normality:



##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.84727, p-value = 0.009748
##
##
## K-S Test for Normality of Residuals:
## Warning in ks.test(aov.out$residuals, "pnorm", alternative = "two.sided"): ties should not be present for the Kolmogorov-Smirnov test

##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.32353, p-value = 0.05694
## alternative hypothesis: two-sided
## Warning: Removed 2 rows containing non-finite values (stat_boxplot).
## Warning: Removed 2 rows containing missing values (geom_point).

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 13.094 0.0006227 ***
## 14
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## =============================
##
## Tests and Plots of Normality:



##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.72382, p-value = 0.000218
##
##
## K-S Test for Normality of Residuals:
## Warning in ks.test(aov.out$residuals, "pnorm", alternative = "two.sided"): ties should not be present for the Kolmogorov-Smirnov test

##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.38235, p-value = 0.01388
## alternative hypothesis: two-sided
## Warning: Removed 2 rows containing non-finite values (stat_boxplot).
## Warning: Removed 2 rows containing missing values (geom_point).

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 52.315 3.188e-07 ***
## 14
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.97173, p-value = 0.848
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.29125, p-value = 0.09012
## alternative hypothesis: two-sided
## Warning: Removed 2 rows containing non-finite values (stat_boxplot).
## Warning: Removed 2 rows containing missing values (geom_point).

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 2.242 0.143
## 14
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.91704, p-value = 0.1316
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.3468, p-value = 0.02487
## alternative hypothesis: two-sided
## Warning: Removed 2 rows containing non-finite values (stat_boxplot).
## Warning: Removed 2 rows containing missing values (geom_point).

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 1.1161 0.355
## 14
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.99115, p-value = 0.9996
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.10067, p-value = 0.9883
## alternative hypothesis: two-sided
## Warning: Removed 2 rows containing non-finite values (stat_boxplot).
## Warning: Removed 2 rows containing missing values (geom_point).

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 0.1958 0.8244
## 14
##
## =============================
##
## Tests and Plots of Normality:



##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.94068, p-value = 0.3263
##
##
## K-S Test for Normality of Residuals:
## Warning in ks.test(aov.out$residuals, "pnorm", alternative = "two.sided"): ties should not be present for the Kolmogorov-Smirnov test

##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.18933, p-value = 0.5759
## alternative hypothesis: two-sided
## Warning: Removed 2 rows containing non-finite values (stat_boxplot).
## Warning: Removed 2 rows containing missing values (geom_point).

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 2.4866 0.1191
## 14
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.86644, p-value = 0.0193
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.44035, p-value = 0.001611
## alternative hypothesis: two-sided
## Warning: Removed 2 rows containing non-finite values (stat_boxplot).
## Warning: Removed 2 rows containing missing values (geom_point).

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 1.9067 0.1852
## 14
##
## =============================
##
## Tests and Plots of Normality:



##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.95844, p-value = 0.6024
##
##
## K-S Test for Normality of Residuals:
## Warning in ks.test(aov.out$residuals, "pnorm", alternative = "two.sided"): ties should not be present for the Kolmogorov-Smirnov test

##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.3082, p-value = 0.07914
## alternative hypothesis: two-sided
## Warning: Removed 2 rows containing non-finite values (stat_boxplot).
## Warning: Removed 2 rows containing missing values (geom_point).

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 2.0247 0.1689
## 14
##
## =============================
##
## Tests and Plots of Normality:



##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.90911, p-value = 0.09663
##
##
## K-S Test for Normality of Residuals:
## Warning in ks.test(aov.out$residuals, "pnorm", alternative = "two.sided"): ties should not be present for the Kolmogorov-Smirnov test

##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.25518, p-value = 0.2182
## alternative hypothesis: two-sided
## Warning: Removed 2 rows containing non-finite values (stat_boxplot).
## Warning: Removed 2 rows containing missing values (geom_point).

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 0.4321 0.6575
## 14
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.95726, p-value = 0.5807
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.46435, p-value = 0.0007054
## alternative hypothesis: two-sided
## Warning: Removed 2 rows containing non-finite values (stat_boxplot).
## Warning: Removed 2 rows containing missing values (geom_point).

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 0.3552 0.7072
## 14
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.9476, p-value = 0.4196
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.47059, p-value = 0.0005643
## alternative hypothesis: two-sided
## Warning: Removed 2 rows containing non-finite values (stat_boxplot).
## Warning: Removed 2 rows containing missing values (geom_point).

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: BMI_Class
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 0.5392 0.5949
## 14
colnames(results.bmi) <- c('Dietary Factor', names(res.out))
##Print out summary table
kable(results.bmi, format = 'html', digits=3) %>%
kable_styling(full_width = T)
|
Dietary Factor
|
Total
|
SE Total
|
Normal
|
SE Normal
|
Class 1
|
SE Class 1
|
Class 2-3
|
SE Class 2-3
|
df Effect
|
df Error
|
f-value
|
p-value
|
omega2
|
eta2
|
|
heix1_totalveg
|
3.248
|
0.339
|
3.355
|
0.635
|
3.842
|
0.496
|
2.746
|
0.592
|
2
|
14
|
0.907
|
0.426
|
0.000
|
0.115
|
|
heix2_greens_and_bean
|
3.078
|
0.427
|
3.090
|
0.868
|
3.866
|
0.707
|
2.506
|
0.675
|
2
|
14
|
0.854
|
0.447
|
0.000
|
0.109
|
|
heix3_totalfruit
|
4.281
|
0.331
|
5.000
|
0.000
|
2.963
|
0.829
|
4.709
|
0.291
|
2
|
14
|
5.084
|
0.022
|
0.324
|
0.421
|
|
heix4_wholefruit
|
4.657
|
0.239
|
5.000
|
0.000
|
3.834
|
0.732
|
5.000
|
0.000
|
2
|
14
|
3.135
|
0.075
|
0.201
|
0.309
|
|
heix5_wholegrain
|
4.126
|
0.677
|
5.868
|
1.560
|
2.021
|
0.832
|
4.384
|
0.764
|
2
|
14
|
3.038
|
0.080
|
0.193
|
0.303
|
|
heix6_totaldairy
|
4.995
|
0.746
|
4.557
|
1.469
|
5.391
|
1.750
|
5.025
|
1.036
|
2
|
14
|
0.082
|
0.922
|
0.000
|
0.012
|
|
heix7_totprot
|
2.701
|
0.325
|
2.045
|
0.556
|
3.566
|
0.436
|
2.552
|
0.550
|
2
|
14
|
1.867
|
0.191
|
0.092
|
0.210
|
|
heix8_seaplant_prot
|
3.078
|
0.424
|
2.612
|
0.619
|
4.135
|
0.620
|
2.657
|
0.781
|
2
|
14
|
1.351
|
0.291
|
0.040
|
0.162
|
|
heix9_fattyacid
|
5.342
|
0.797
|
5.443
|
1.832
|
5.540
|
1.698
|
5.128
|
1.064
|
2
|
14
|
0.023
|
0.977
|
0.000
|
0.003
|
|
heix10_sodium
|
5.815
|
0.816
|
7.715
|
0.773
|
4.369
|
1.945
|
5.490
|
1.237
|
2
|
14
|
1.348
|
0.291
|
0.039
|
0.162
|
|
heix11_refinedgrain
|
8.473
|
0.387
|
8.158
|
0.879
|
8.845
|
0.679
|
8.432
|
0.594
|
2
|
14
|
0.213
|
0.811
|
0.000
|
0.030
|
|
heix12_sofaas
|
12.634
|
1.484
|
16.688
|
1.821
|
12.513
|
2.686
|
9.824
|
2.443
|
2
|
14
|
2.087
|
0.161
|
0.113
|
0.230
|
|
hei2010_total_score
|
62.426
|
2.709
|
69.531
|
5.278
|
60.885
|
3.964
|
58.453
|
4.225
|
2
|
14
|
1.618
|
0.233
|
0.068
|
0.188
|
hei_scores %>%
group_by(BMI_Class) %>%
summarise(n = n())
## # A tibble: 3 x 2
## BMI_Class n
## <ord> <int>
## 1 Normal 6
## 2 Class 1 6
## 3 Class 2-3 7
GWG Categories ANOVA for women with pre-preg BMI >= 30
results.gwg <- as.data.frame(matrix(NA, nrow=length(metrics), ncol=15))
hei_scores.bmi30p <- filter(hei_scores, PrePreg_BMI >=30)
iter<- 1
for(met in metrics){
results.gwg[iter,1] <- met
res.out <- ffq_anova(data=hei_scores.bmi30p, v.n=met, group= group.var[2])
results.gwg[iter,2:15] <- res.out
iter <- iter + 1
}
##
## =============================
##
## Tests and Plots of Normality:



##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.90537, p-value = 0.186
##
##
## K-S Test for Normality of Residuals:
## Warning in ks.test(aov.out$residuals, "pnorm", alternative = "two.sided"): ties should not be present for the Kolmogorov-Smirnov test

##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.16496, p-value = 0.8997
## alternative hypothesis: two-sided
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
## Warning: Removed 1 rows containing missing values (geom_point).

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 2.9767 0.1018
## 9
##
## =============================
##
## Tests and Plots of Normality:



##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.89114, p-value = 0.1219
##
##
## K-S Test for Normality of Residuals:
## Warning in ks.test(aov.out$residuals, "pnorm", alternative = "two.sided"): ties should not be present for the Kolmogorov-Smirnov test

##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.23148, p-value = 0.5411
## alternative hypothesis: two-sided
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
## Warning: Removed 1 rows containing missing values (geom_point).

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 2.1382 0.1739
## 9
##
## =============================
##
## Tests and Plots of Normality:



##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.87541, p-value = 0.07657
##
##
## K-S Test for Normality of Residuals:
## Warning in ks.test(aov.out$residuals, "pnorm", alternative = "two.sided"): ties should not be present for the Kolmogorov-Smirnov test

##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.25, p-value = 0.4413
## alternative hypothesis: two-sided
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
## Warning: Removed 1 rows containing missing values (geom_point).

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 6.9123 0.01518 *
## 9
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## =============================
##
## Tests and Plots of Normality:



##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.79333, p-value = 0.007877
##
##
## K-S Test for Normality of Residuals:
## Warning in ks.test(aov.out$residuals, "pnorm", alternative = "two.sided"): ties should not be present for the Kolmogorov-Smirnov test

##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.33333, p-value = 0.1389
## alternative hypothesis: two-sided
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
## Warning: Removed 1 rows containing missing values (geom_point).

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 7.113 0.01403 *
## 9
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.97124, p-value = 0.9233
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.25718, p-value = 0.3448
## alternative hypothesis: two-sided
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
## Warning: Removed 1 rows containing missing values (geom_point).

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 2.3438 0.1516
## 9
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.97936, p-value = 0.981
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.36026, p-value = 0.06692
## alternative hypothesis: two-sided
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
## Warning: Removed 1 rows containing missing values (geom_point).

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 0.7556 0.4973
## 9
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.96913, p-value = 0.9015
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.12606, p-value = 0.9785
## alternative hypothesis: two-sided
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
## Warning: Removed 1 rows containing missing values (geom_point).

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 0.7241 0.511
## 9
##
## =============================
##
## Tests and Plots of Normality:



##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.85152, p-value = 0.03834
##
##
## K-S Test for Normality of Residuals:
## Warning in ks.test(aov.out$residuals, "pnorm", alternative = "two.sided"): ties should not be present for the Kolmogorov-Smirnov test

##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.34169, p-value = 0.1213
## alternative hypothesis: two-sided
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
## Warning: Removed 1 rows containing missing values (geom_point).

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 1.8776 0.2082
## 9
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.89252, p-value = 0.127
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.40204, p-value = 0.02903
## alternative hypothesis: two-sided
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
## Warning: Removed 1 rows containing missing values (geom_point).

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 1.0643 0.3847
## 9
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.89051, p-value = 0.1196
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.36572, p-value = 0.06034
## alternative hypothesis: two-sided
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
## Warning: Removed 1 rows containing missing values (geom_point).

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 0.5226 0.6099
## 9
##
## =============================
##
## Tests and Plots of Normality:



##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.8687, p-value = 0.06293
##
##
## K-S Test for Normality of Residuals:
## Warning in ks.test(aov.out$residuals, "pnorm", alternative = "two.sided"): ties should not be present for the Kolmogorov-Smirnov test

##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.32343, p-value = 0.1624
## alternative hypothesis: two-sided
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
## Warning: Removed 1 rows containing missing values (geom_point).

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 0.5756 0.5818
## 9
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.93318, p-value = 0.4151
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.41346, p-value = 0.0227
## alternative hypothesis: two-sided
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
## Warning: Removed 1 rows containing missing values (geom_point).

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 1.2299 0.3371
## 9
##
## =============================
##
## Tests and Plots of Normality:




##
## Shapiro-Wilks Test of Normality of Residuals:
##
## Shapiro-Wilk normality test
##
## data: res
## W = 0.95425, p-value = 0.6997
##
##
## K-S Test for Normality of Residuals:
##
## One-sample Kolmogorov-Smirnov test
##
## data: aov.out$residuals
## D = 0.53693, p-value = 0.0009215
## alternative hypothesis: two-sided
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
## Warning: Removed 1 rows containing missing values (geom_point).

##
## =============================
##
## Tests of Homogeneity of Variance
##
##
## Levenes Test: GWG_Cat
##
##
## Levene's Test for Homogeneity of Variance (center = "mean")
## Df F value Pr(>F)
## group 2 4.1666 0.05238 .
## 9
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
colnames(results.gwg) <- c('Dietary Factor', names(res.out))
##Print out summary table
kable(results.gwg, format = 'html', digits=3) %>%
kable_styling(full_width = T)
|
Dietary Factor
|
Total
|
SE Total
|
Below
|
SE Below
|
Within
|
SE Within
|
Above
|
SE Above
|
df Effect
|
df Error
|
f-value
|
p-value
|
omega2
|
eta2
|
|
heix1_totalveg
|
3.203
|
0.419
|
2.506
|
0.841
|
4.320
|
0.425
|
2.270
|
0.204
|
2
|
9
|
3.937
|
0.059
|
0.329
|
0.467
|
|
heix2_greens_and_bean
|
3.073
|
0.511
|
2.376
|
0.946
|
4.518
|
0.482
|
1.594
|
0.176
|
2
|
9
|
5.477
|
0.028
|
0.427
|
0.549
|
|
heix3_totalfruit
|
3.982
|
0.445
|
5.000
|
0.000
|
3.398
|
0.635
|
3.596
|
1.404
|
2
|
9
|
1.425
|
0.290
|
0.066
|
0.240
|
|
heix4_wholefruit
|
4.514
|
0.333
|
5.000
|
0.000
|
4.519
|
0.481
|
3.859
|
1.141
|
2
|
9
|
0.807
|
0.476
|
0.000
|
0.152
|
|
heix5_wholegrain
|
3.400
|
0.644
|
4.297
|
0.582
|
2.266
|
0.754
|
4.093
|
2.166
|
2
|
9
|
1.145
|
0.360
|
0.024
|
0.203
|
|
heix6_totaldairy
|
5.177
|
0.899
|
4.799
|
1.358
|
4.473
|
1.337
|
6.856
|
2.492
|
2
|
9
|
0.544
|
0.598
|
0.000
|
0.108
|
|
heix7_totprot
|
2.974
|
0.384
|
2.795
|
0.975
|
3.428
|
0.467
|
2.458
|
0.543
|
2
|
9
|
0.503
|
0.621
|
0.000
|
0.100
|
|
heix8_seaplant_prot
|
3.273
|
0.548
|
2.945
|
1.213
|
3.305
|
0.902
|
3.656
|
0.904
|
2
|
9
|
0.101
|
0.905
|
0.000
|
0.022
|
|
heix9_fattyacid
|
5.300
|
0.895
|
4.947
|
1.818
|
5.694
|
1.642
|
5.113
|
1.341
|
2
|
9
|
0.059
|
0.943
|
0.000
|
0.013
|
|
heix10_sodium
|
5.023
|
1.043
|
6.667
|
1.628
|
4.435
|
1.909
|
3.812
|
1.915
|
2
|
9
|
0.602
|
0.568
|
0.000
|
0.118
|
|
heix11_refinedgrain
|
8.604
|
0.431
|
8.610
|
1.058
|
8.679
|
0.636
|
8.471
|
0.695
|
2
|
9
|
0.015
|
0.985
|
0.000
|
0.003
|
|
heix12_sofaas
|
10.944
|
1.775
|
8.132
|
4.287
|
11.766
|
2.523
|
13.324
|
1.645
|
2
|
9
|
0.643
|
0.548
|
0.000
|
0.125
|
|
hei2010_total_score
|
59.466
|
2.862
|
58.075
|
7.512
|
60.800
|
4.000
|
59.099
|
3.337
|
2
|
9
|
0.072
|
0.931
|
0.000
|
0.016
|
hei_scores.bmi30p %>%
group_by(GWG_Cat) %>%
summarise(n = n())
## # A tibble: 3 x 2
## GWG_Cat n
## <ord> <int>
## 1 Below 4
## 2 Within 5
## 3 Above 4